﻿using Grow.Domain.Object;
using Grow.Module.Builder;
using Grow.Module.Options;

namespace Grow.Domain.Repository.CreateDomainRepository
{
    /// <summary>
    /// Db 构建对象
    /// </summary>
    public interface ICreateDomainRepositoryBuilder : IBuilder
    {
        /// <summary>
        /// 获取 Table Map 集合
        /// </summary>
        /// <returns></returns>
        IEnumerable<IDbMap> GetTableMaps();


        /// <summary>
        /// 添加Table Map
        /// </summary>
        /// <typeparam name="TTableMap"></typeparam>
        /// <returns></returns>
        ICreateDomainRepositoryBuilder AddDbMap<TTableMap>()
            where TTableMap : IDbMap, new();
        ICreateDomainRepositoryBuilder AddDomainRepository<TDomainRepositoryService, TDomainRepositoryImplementation, TAggregateRoot>()
           where TDomainRepositoryService : class, IDomainRepository<TAggregateRoot>
           where TDomainRepositoryImplementation : class, TDomainRepositoryService
           where TAggregateRoot : class, IAggregateRoot;

        /// <summary>
        /// 获取UnitOfWorkOptionsAction  选项
        /// </summary>
        /// <param name="unitOfWorkOptionsAction"></param>
        /// <returns></returns>
        ICreateDomainRepositoryBuilder AddUnitOfWork(Action<IOptionsBind, UnitOfWorkOptions> unitOfWorkOptionsAction);

    }
}
